home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr28 / del105.zip / MD5SUM.TXT < prev    next >
Text File  |  1995-02-04  |  7KB  |  160 lines

  1. MD5SUM.TXT -- Documentation for MD5SUM.EXE
  2.  
  3.  
  4. WHAT IS THIS?
  5.  
  6. MD5SUM is a Public Domain program used for computing and checking
  7. cryptographic message digests (or check values) of files.  It was written
  8. with the Unix philosophy of reading from standard input and writing to
  9. standard output, and options are delimited with "-" instead of "/".  To get a
  10. rather terse help message, type
  11.  
  12. md5sum -h
  13.  
  14. at the DOS prompt.  Md5sum.exe will respond with:
  15.  
  16. usage: md5sum [-bv] [-c [file]] | [file...]
  17.     Generates or checks MD5 Message Digests
  18.         -c  check message digests (default is generate)
  19.         -v  verbose, print file names when checking
  20.         -b  read files in binary mode
  21.     The input for -c should be the list of message digests and file names
  22.     that is printed on stdout by this program when it generates digests.
  23.  
  24. When checking files, MD5SUM generates no output if the files match their
  25. fingerprints, unless you also specify the -v switch.  If there is a problem,
  26. it will generate one or more of the following messages:
  27.  
  28. MD5SUM.EXE: can't open filename
  29. MD5SUM.EXE: error reading filename
  30. MD5SUM.EXE: MD5 check failed for filename
  31. MD5SUM.EXE: _ of _ file(s) failed MD5 check
  32. MD5SUM.EXE: no files checked
  33.  
  34.  
  35. WHY WOULD I WANT TO DO THAT?
  36.  
  37. If the MD5 message digest "fingerprint" of a file has not changed, this is a
  38. VERY good indication that the contents of the file has not changed.  Even if
  39. you wanted to change a file in such a way that it still had the same MD5
  40. "fingerprint," you probably couldn't do it without a lot of supercomputer
  41. time (and neither could a bad guy).  This makes it useful for detection of
  42. forgeries, viruses, and just plain transmission errors.  Note that this is
  43. much more powerful than a normal CRC, which is good at detecting some kinds
  44. of transmission errors, but can easily be forged.  This is also useful for
  45. signing a collection of files with a digital signature (using PGP, a PEM
  46. implementation, or some kind of DSA implementation, for example), without
  47. having to individually sign each file.  Simply create a text file with the
  48. "fingerprints" of each file you wish to sign, then sign that text file.
  49.  
  50.  
  51. COMPUTING FILE MD5 FINGERPRINTS
  52.  
  53. To compute the MD5 fingerprint of a text file, simply type
  54.  
  55. MD5SUM filename(s)
  56.  
  57. Unfortunately, "wild cards" (like * and ?) are not supported by this program,
  58. but you can put more than one file name on the command line.  Since the
  59. program is assuming that this is a text file, line endings conventions may
  60. differ and still result in the same check value.
  61.  
  62. To compute the MD5 fingerpring of any file, include the -b option (for
  63. binary):
  64.  
  65. MD5SUM -b filename(s)
  66.  
  67. To see the file names displayed while computing "fingerprints," include the
  68. -v option, like:
  69.  
  70. MD5SUM -bv filename(s)
  71.  
  72. To write the output to a file instead of just displaying it on the screen,
  73. use redirection with the ">" character, like:
  74.  
  75. MD5SUM -bv filename(s) > md5file
  76.  
  77. To append the output to an existing file, use two > characters, like:
  78.  
  79. MD5SUM -bv filename(s) >> md5file
  80.  
  81.  
  82. ADDING COMMENTS TO CHECK FILES
  83.  
  84. Sometimes it is nice to add comments to files containing MD5 fingerprints. To
  85. do this, just edit the files made using the above instructions to add in what
  86. you want to say.  Lines that do not start with valid hexadecimal digits are
  87. ignored as comments.
  88.  
  89.  
  90. CHECKING FILES AGAINST STORED FINGERPRINTS
  91.  
  92. To check all of the files listed in check files as generated above to see if
  93. they have changed:
  94.  
  95. MD5SUM -c md5file
  96.  
  97. For a more verbose listing of results (listing file names followed by "OK" or
  98. "FAILED"), type:
  99.  
  100. MD5SUM -cv md5file
  101.  
  102.  
  103. DETECTING MODIFICATION OR FORGERY OF FINGERPRINT FILES
  104.  
  105. One way to prevent alteration of fingerprint files is to store several copies
  106. in different secure places, then compare them from time to time.  Another way
  107. is to use a digital signature produced by PGP, some PEM implementation, or a
  108. DSS implementation.  PGP is the most widely used digital signature program in
  109. the public sector right now.
  110.  
  111.  
  112. SOURCE CODE
  113.  
  114. The source code I used to compile MD5SUM.EXE is available in the file
  115. MD5SUM.ZIP (available on the Colorado Catacombs BBS at 303-772-1062).  I did
  116. some minor edits to the source code as distributed with the Pretty Good
  117. Privacy program (PGP) to make the compile completely free of warning messages
  118. with my compiler, but made no functional changes to the code.  I checked to
  119. make sure that the result was compatible with the "pure" code from the PGP
  120. distribution.  I resisted temptation to make the command line and user
  121. interface more like a DOS program, so this works exactly like the PGP
  122. distribution compiled for other platforms.  Source code is supplied so that
  123. you can see how this works and see for yourself that there is no "monkey
  124. business" in the code.  You may also have an opportunity to make use of some
  125. of it for other applications.
  126.  
  127. These are the commands used with Borland C++ 4.02 and PKLITE professional
  128. 1.13 that I used to compile MD5SUM.EXE:
  129.  
  130. bcc -mh -O2 md5sum.c md5.c getopt.c
  131. pklite -r md5sum.exe
  132.  
  133.  
  134. LEGAL NOTICES AND CREDITS
  135.  
  136. Nobody involved in this program makes any warranty of any kind regarding this
  137. documentation or its associated source code and executable programs.  Because
  138. this is in the Public Domain, we have no legal control over it anyway.  Even
  139. though we might think this is useful and performs substantially as
  140. documented, variations in computer hardware, operating systems, bugs, errors,
  141. and other effects could happen.  It is up to you to determine if this is
  142. useful, and if you use it, you do so entirely at your own risk. In case the
  143. nearest star goes supernova, this program will likely cease to function for
  144. lack of any hardware to run on.
  145.  
  146. This program and its documentation are in the Public Domain.  Copy it, use
  147. it, sell it, modify it, or ignore it as you see fit.  Just don't attempt to
  148. claim it as your own work and copyright it or patent it, or we will be very
  149. angry.  The message digest algorithm used is MD5, invented by Ron Rivest. The
  150. message digest code used was written by Colin Plumb in 1993 with no copyright
  151. claimed.  It has been tested against the RSA Data Security, Inc., reference
  152. implementation, but does not use that implementation.  The MD5SUM main
  153. program was written by Branko Lankester in 1993, and modified slightly by
  154. Colin Plumb.  The getopt.c source code is public domain code from AT&T. This
  155. documentation was written by Michael Paul Johnson in 1995. The compiler used
  156. was Borland C++. Unix is a trademark of AT&T and is used for identification
  157. purposes only. This program is not a munition, but it can be modified to be a
  158. munition (for example, by adding some high explosives and a detonator).
  159.  
  160.